<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ include file="/includes/taglibs.jsp"%>
<%@ taglib uri="/WEB-INF/extremecomponents.tld" prefix="ec"%>
<%@ page import="com.cq.xjms.model.User"  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>课程列表</title>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/common.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/extremecomponents.css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.4.2.min.js"></script>
<style type="text/css">
	.eXtremeTable .tableHeader {
	height: 26px; 
	line-height:25px;
	background:url(/images/platform/tr.jpg) repeat;
	color: #000;
	font-weight: bold;
	border: 0px solid #CCC;
	background-image: url("/images/platform/tr1.jpg") no-repeat;
	background-position: top right;
	white-space: nowrap;
	overflow: hidden;
}
</style>
<script type="text/javascript">
	function del(id){
		window.location.href = "deleteCourse.action?course.id="+id;
	}
	function edit(id){
		window.location.href = "editCourse.action?course.id="+id;
	}
</script>
<%
	Object obj = request.getSession().getAttribute("login_user");
%>
</head>
	<body>
		<div id="man_zone">
		
		<form action="listCourse.action" method="post" id="form1" >
		 <table class="table_style" border="0" align="center"  cellpadding="3" cellspacing="1" width="1000px">
		   	<tr>
		   		<td class="left_title_1">课程名:</td>
		   		<td>
		   		<input type="text" id="course.name" name="course.name" value="${course.name}"/>
		   		</td>
		   		<td class="left_title_1">课程编号:</td>
		   		<td>
		   		<input type="text" id="course.code" name="course.code" value="${course.code}"/>
		   		</td>	
		   	</tr>
		   	<tr>
		   		<td class="left_title_1">教师名:</td>
		   		<td>
		   			<select name="course.teacher.id">
		   				<option>---请选择教师---</option>
		   				<s:iterator value="teachers" >
		   					<option value="${id}" <s:if test="id==course.teacher.id">selected</s:if> >${name}</option>
		   				</s:iterator>
		   			</select>
		   		</td>
		   		<td colspan="2"> <input type="submit" value="查询"/> </td>
		   	</tr>
		</table>
		</form>
		<ec:table retrieveRowsCallback="limit" cellspacing="1" filterable="false"   items="courses" var="course" action="listCourse.action">
				<ec:row>
					<ec:column property="name" title="课程名" width="20%">
					</ec:column>
					<ec:column property="code"  title="课程编号" width="15%">
					</ec:column>
					<ec:column property="teacher.name" title="授课教师" width="15%"/>
					<ec:column property="credit" title="学分" width="10%" />
					<ec:column property="term" title="学期" width="30%"/>
					<ec:column property="status" title="课程类型" width="30%">
						<s:if test="#attr.course.status == 0">待定</s:if>
						<s:if test="#attr.course.status == 1">必选课</s:if>
						<s:if test="#attr.course.status == 2">限选课</s:if>
						<s:if test="#attr.course.status == 3">通选课</s:if>
					</ec:column>
					<%if(obj instanceof User){ %>
					<ec:column property="操作" sortable="false" 
						filterable="false" width="10%">
						<s:a href="###"
							onclick="edit(%{#attr.course.id});">修改</s:a>
						<s:a href="###"
							onclick="del(%{#attr.course.id});">删除</s:a>
					</ec:column>
					<%} %>
				</ec:row>
				</ec:table>
		</div>
	</body>
</html>